<template>
  <div v-if="loading"><加载中></div>
  <div v-else>{{ value || props.modelValue }}</div>
</template>
<script setup lang="ts">
  import { Column } from '@/seed-application/types';
  import { labelApi } from '@/seed-application/utils/RelUtil';
  import { ref, watch } from "vue";

  const props = defineProps<{ column: Column, modelValue?: any }>()
  const value = ref<string>()
  const loading = ref(false)  

  watch(() => props.modelValue, async () => {
    loading.value = true
    value.value = await labelApi(props.column, props.modelValue)
    loading.value = false
  }, { immediate: true })
</script>